/**
 @author Jacye.Ouyang
 */
// cType: component type, cPath : the access path of component, the variable name of tickerValidation object,

if(typeof(SYMBLETYPE)=="undefined"){
	var SYMBLETYPE = {
    "ST": "Equities",
    "Funds": "Funds",
    "Futures": "",
    "Forex": "",
    "Bonds": "",
    "XI": "Index",
    "FE": "ETF",
    "FC": "Closed-End Fund",
    "FO": "Mutual Fund"
    }
}
if(typeof(mockExchangeCode)=="undefined"){
    mockExchangeCode = "9999";
}
var QS_MSICIndexs={'XIUSA000X8':'27_0P00001GGA_MSCI AC Americas USD',
'XIUSA000XB':'27_0P00001GGC_MSCI AC Asia USD',
'XIUSA000XE':'27_0P00001GGG_MSCI AC Asia Pac USD',
'XIUSA000XC':'27_0P00001GGE_MSCI AC Asia Pac EX JPN USD',
'XIUSA000F6':'27_0P00001FYF_MSCI AC Asia EX Japan USD',
'XIUSA000N6':'27_0P00001G6F_MSCI AC Europe USD',
'FOUSA05QNR':'27_0P00006KZ5_MSCI AC Europe Growth USD',
'FOUSA05QO2':'27_0P00006KZG_MSCI AC Europe Value USD',
'XIUSA000MY':'27_0P00001G67_MSCI AC Far East USD',
'XIUSA000F4':'27_0P00001FYD_MSCI AC Far East Ex Japan USD',
'FOUSA05QO4':'27_0P00006KZI_MSCI AC Far East Ex Japan Ex HK USD',
'XIUSA000XK':'27_0P00001GGM_MSCI AC Pacific USD',
'XIUSA000XI':'27_0P00001GGK_MSCI AC Pacific Ex Japan USD',
'FOUSA05QOW':'27_0P00006L0A_MSCI AC Pacific Ex Japan Ex HK USD',
'XIUSA000JH':'27_0P00001G2Q_MSCI AC World USD',
'FOUSA05QP3':'27_0P00006L0H_MSCI AC World Ex Australia USD',
'XIUSA04EX9':'27_0P00001L8F_MSCI AC World Ex EMU USD',
'XIUSA000HT':'27_0P00001G12_MSCI AC World Ex Japan USD',
'XIUSA000JL':'27_0P00001G12_MSCI AC World Ex USA USD',
'FOUSA07D59':'27_0P0000GW4G_MSCI AC FM Asia USD',
'FOUSA07D53':'27_0P0000GW4A_MSCI AC FM E&C USD',
'FOUSA07D4L':'27_0P0000GW3S_MSCI ACWI FM USD',
'FOUSA07D4X':'27_0P0000GW44_MSCI ACWI FM Ex JPN USD',
'FOUSA07D4R':'27_0P0000GW3Y_MSCI ACWI FM Ex USA USD',
'XIUSA000FN':'27_0P00001FYW_MSCI EAFE&EM USD',
'XIUSA04GAV':'27_0P00001MM1_MSCI AC Golden Dragon USD',
'FOUSA05V1J':'27_0P00006QLP_MSCI AC Zhong Hua USD',
'XIUSA000CV':'27_0P00001FW4_MSCI EAFE USD',
'XIUSA000FC':'27_0P00001FYL_MSCI EAFE&Canada USD',
'XIUSA000FX':'27_0P00001FZ6_MSCI EAFE ex UK USD',
'XIUSA000G2':'27_0P00001FZB_MSCI EASEA USD',
'XIUSA000XQ':'27_0P00001GGS_MSCI EMU USD',
'FOUSA05US8':'27_0P00006QCG_MSCI EMU Ex Germany USD',
'XIUSA000N3':'27_0P00001G6C_MSCI EU USD',
'XIUSA000XS':'27_0P00001GGU_MSCI Euro USD',
'XIUSA000EK':'27_0P00001FXT_MSCI Europe USD',
'XIUSA000XG':'27_0P00001GGI_MSCI AC Europe&Middle East USD',
'XIUSA000HL':'27_0P00001G0U_MSCI Europe GDP Weighted USD',
'XIUSA04F9T':'27_0P00001LKZ_MSCI Europe Ex EMU USD',
'XIUSA04FAT':'27_0P00001LLZ_MSCI Europe Ex Switzerland USD',
'XIUSA000H1':'27_0P00001G0A_MSCI Europe ex UK USD',
'XIUSA000GS':'27_0P00001G01_MSCI Far East USD',
'XIUSA000XU':'27_0P00001GGW_MSCI G7 USD',
'XIUSA000GY':'27_0P00001G07_MSCI Kokusai (World Ex Japan) USD',
'XIUSA000GR':'27_0P00001G00_MSCI Nordic Countries USD',
'XIUSA000GQ':'27_0P00001FZZ_MSCI North America USD',
'XIUSA000HO':'27_0P00001G0X_MSCI Pacific USD',
'XIUSA000GZ':'27_0P00001G08_MSCI Pacific ex Japan USD',
'XIUSA04FI4':'27_0P00001LTA_MSCI PanEuro USD',
'XIUSA000CW':'27_0P00001FW5_MSCI World USD',
'XIUSA000HN':'27_0P00001G0W_MSCI World Ex Australia USD',
'XIUSA04FKS':'27_0P00001LVY_MSCI World Ex EMU USD',
'XIUSA000XY':'27_0P00001GH0_MSCI World Ex Europe USD',
'XIUSA000H0':'27_0P00001G09_MSCI World Ex UK USD',
'XIUSA000JL':'27_0P00001G2U_MSCI AC World Ex USA USD',
'XIUSA000FR':'27_0P00001FZ0_MSCI EAFE Free USD',
'XIUSA000GW':'27_0P00001G05_MSCI Far East Free USD',
'XIUSA000GU':'27_0P00001G03_MSCI Pacific Free USD',
'XIUSA000GV':'27_0P00001G04_MSCI Pacific Free Ex Japan USD',
'XIUSA000GT':'27_0P00001G02_MSCI World Free USD',
'FOUSA06ETP':'27_0P00008KQ4_MSCI BRIC USD',
'FOUSA07D33':'27_0P0000GW2A_MSCI EFM USD',
'FOUSA06VS6':'27_0P0000GBG8_MSCI EFM Africa USD',
'FOUSA07D43':'27_0P0000GW3A_MSCI EFM Africa Ex ZAF USD',
'FOUSA07D49':'27_0P0000GW3G_MSCI EFM Asia USD',
'FOUSA07D3F':'27_0P0000GW2M_MSCI EFM CEEC Ex RUS USD',
'FOUSA07D3X':'27_0P0000GW34_MSCI EFM EMEA USD',
'FOUSA07D3L':'27_0P0000GW2S_MSCI EFM E&C USD',
'FOUSA07D3R':'27_0P0000GW2Y_MSCI EFM E&C Ex Rus USD',
'XIUSA000G7':'27_0P00001FZG_MSCI EM USD',
'XIUSA000G9':'27_0P00001FZI_MSCI EM Asia USD',
'XIUSA000K0':'27_0P00001G39_MSCI EM Eastern Europe USD',
'FOUSA06FAM':'27_0P00008L6N_MSCI EM EMEA USD',
'XIUSA000JZ':'27_0P00001G38_MSCI EM Europe USD',
'XIUSA000JG':'27_0P00001G2P_MSCI EM Europe&Middle East USD',
'XIUSA000GB':'27_0P00001FZK_MSCI EM Far East USD',
'XIUSA000HP':'27_0P00001G0Y_MSCI EM Latin America USD',
'F00000GW7M':'27_0P0000NB35_MSCI EM Ex Asia PR USD',
'FOUSA06O6E':'27_0P0000A4JC_MSCI Jordan Egypt Morocco GR USD',
'FOUSA06V5B':'27_0P0000G79M_MSCI Frontier Markets USD',
'FOUSA06V5H':'27_0P0000G79Y_MSCI FM Africa USD',
'FOUSA09K80':'27_0P0000MXZH_MSCI FM Asia PR USD',
'FOUSA06V5N':'27_0P0000G7AA_MSCI FM Central&EasternEurope&CIS USD',
'FOUSA06V5T':'27_0P0000G7AM_MSCI FM EMEA USD',
'FOUSA09K86':'27_0P0000MXZN_MSCI FM Latin America &Caribbean PR USD',
'FOUSA06V5Z':'27_0P0000G7AY_MSCI FM Ex GCC USD',
'FOUSA09K8C':'27_0P0000MXZT_MSCI Frontier Emerging Market PR USD',
'XIUSA000CY':'27_0P00001FW7_MSCI Austria USD',
'XIUSA000DJ':'27_0P00001FWS_MSCI Belgium USD',
'XIUSA000D1':'27_0P00001FWA_MSCI Denmark USD',
'XIUSA000D2':'27_0P00001FWB_MSCI Finland USD',
'XIUSA000D3':'27_0P00001FWC_MSCI France USD',
'XIUSA000D4':'27_0P00001FWD_MSCI Germany USD',
'XIUSA000E7':'27_0P00001FXG_MSCI Greece USD',
'XIUSA000ND':'27_0P00001G6M_MSCI Ireland USD',
'XIUSA000D7':'27_0P00001FWG_MSCI Italy USD',
'XIUSA000DA':'27_0P00001FWJ_MSCI Netherlands USD',
'XIUSA000DC':'27_0P00001FWL_MSCI Norway USD',
'XIUSA000NQ':'27_0P00001G6Z_MSCI Portugal USD',
'XIUSA000DE':'27_0P00001FWN_MSCI Spain USD',
'XIUSA000DF':'27_0P00001FWO_MSCI Sweden USD',
'XIUSA000DG':'27_0P00001FWP_MSCI Switzerland USD',
'XIUSA000DH':'27_0P00001FWQ_MSCI UK USD',
'XIUSA000EK':'27_0P00001FXT_MSCI Europe USD',
'XIUSA000XQ':'27_0P00001GGS_MSCI EMU USD',
'XIUSA04F9T':'27_0P00001LKZ_MSCI Europe Ex EMU USD',
'XIUSA000H1':'27_0P00001G0A_MSCI Europe ex UK USD',
'XIUSA000GR':'27_0P00001G00_MSCI Nordic Countries USD',
'XIUSA000CX':'27_0P00001FW6_MSCI Australia USD',
'XIUSA000D5':'27_0P00001FWE_MSCI Hong Kong USD',
'XIUSA000D8':'27_0P00001FWH_MSCI Japan USD',
'XIUSA000DB':'27_0P00001FWK_MSCI New Zealand USD',
'XIUSA000DD':'27_0P00001FWM_MSCI Singapore USD',
'XIUSA000HO':'27_0P00001G0X_MSCI Pacific USD',
'XIUSA000GZ':'27_0P00001G08_MSCI Pacific ex Japan USD',
'XIUSA000CZ':'27_0P00001FW8_MSCI Canada USD',
'XIUSA000H3':'27_0P00001G0C_MSCI USA USD',
'XIUSA000GQ':'27_0P00001FZZ_MSCI North America USD',
'XIUSA000CV':'27_0P00001FW4_MSCI EAFE USD',
'XIUSA000GS':'27_0P00001G01_MSCI Far East USD',
'XIUSA000D6':'27_0P00001FWF_MSCI Israel USD',
'XIUSA000CW':'27_0P00001FW5_MSCI World USD',
'XIUSA000G2':'27_0P00001FZB_MSCI EASEA USD',
'XIUSA000GY':'27_0P00001G07_MSCI Kokusai (World Ex Japan) USD',
'XIUSA000H2':'27_0P00001G0B_MSCI Singapore Free USD',
'XIUSA000KF':'27_0P00001G3O_MSCI China USD',
'XIUSA000NC':'27_0P00001G6L_MSCI India USD',
'XIUSA000K9':'27_0P00001G3I_MSCI EM Indonesia PR USD',
'XIUSA000NH':'27_0P00001G6Q_MSCI Korea USD',
'XIUSA000K5':'27_0P00001G3E_MSCI Malaysia USD',
'XIUSA000NP':'27_0P00001G6Y_MSCI Philippines USD',
'XIUSA000NW':'27_0P00001G75_MSCI Taiwan USD',
'XIUSA000K7':'27_0P00001G3G_MSCI Thailand USD',
'XIUSA000G9':'27_0P00001FZI_MSCI EM Asia USD',
'XIUSA000GB':'27_0P00001FZK_MSCI EM Far East USD',
'XIUSA000MV':'27_0P00001G64_MSCI Brazil USD',
'XIUSA000MZ':'27_0P00001G68_MSCI Chile USD',
'XIUSA000D0':'27_0P00001FW9_MSCI Colombia USD',
'XIUSA000KD':'27_0P00001G3M_MSCI Mexico USD',
'XIUSA000GO':'27_0P00001FZX_MSCI Peru USD',
'XIUSA000HP':'27_0P00001G0Y_MSCI EM Latin America USD',
'XIUSA000IF':'27_0P00001G1O_MSCI Czech Republic USD',
'XIUSA000IG':'27_0P00001G1P_MSCI Hungary USD',
'XIUSA000JS':'27_0P00001G31_MSCI Poland USD',
'XIUSA000K3':'27_0P00001G3C_MSCI Russia USD',
'XIUSA000NY':'27_0P00001G77_MSCI Turkey USD',
'XIUSA000JG':'27_0P00001G2P_MSCI EM Europe&Middle East USD',
'XIUSA000JZ':'27_0P00001G38_MSCI EM Europe USD',
'XIUSA000K0':'27_0P00001G39_MSCI EM Eastern Europe USD',
'XIUSA000XO':'27_0P00001GGQ_MSCI Egypt USD',
'XIUSA000XW':'27_0P00001GGY_MSCI Morocco USD',
'XIUSA000JU':'27_0P00001G33_MSCI South Africa USD',
'XIUSA000G7':'27_0P00001FZG_MSCI EM USD',
'FOUSA063SQ':'27_0P00007PNG_MSCI EAFE&Canada Value USD',
'XIUSA04F2E':'27_0P00001LDK_MSCI EAFE Value USD',
'FOUSA063SW':'27_0P00007PNM_MSCI EAFE Ex UK Value USD',
'XIUSA04F2N':'27_0P00001LDT_MSCI EASEA Value USD',
'XIUSA04F6K':'27_0P00001LHQ_MSCI EMU Value USD',
'FOUSA05UR9':'27_0P00006Q9V_MSCI EM Europe&ME Growth USD',
'XIUSA04FBB':'27_0P00001LMH_MSCI Europe Value USD',
'XIUSA04FB2':'27_0P00001LM8_MSCI Europe Ex UK Value USD',
'FOUSA05USV':'27_0P00007YG9_MSCI Far East Value USD',
'XIUSA04FGQ':'27_0P00001LRW_MSCI Nordic Countries Value USD',
'XIUSA04FGZ':'27_0P00001LS5_MSCI North America Value USD',
'XIUSA04FI1':'27_0P00001LT7_MSCI Pacific Value USD',
'XIUSA04FHH':'27_0P00001LSN_MSCI Pacific Ex Japan Value USD',
'XIUSA04FK6':'27_0P00001LVC_MSCI World Value USD',
'FOUSA05UZT':'27_0P00006QK1_MSCI World Ex Australia Value USD',
'FOUSA05V05':'27_0P00006QKD_MSCI World Ex UK Value USD',
'FOUSA05V0B':'27_0P00006QKH_MSCI World Ex USA Value USD',
'XIUSA04F26':'27_0P00001LDC_MSCI EAFE Free Value USD',
'FOUSA05USR':'27_0P00006QCZ_MSCI Far East Free Value USD',
'XIUSA04FHT':'27_0P00001LSZ_MSCI Pacific Free Value USD',
'XIUSA04F0R':'27_0P00001LBX_MSCI Austria Value USD',
'XIUSA04F10':'27_0P00001LC6_MSCI Belgium Value USD',
'XIUSA04F1Y':'27_0P00001LD4_MSCI Denmark Value USD',
'XIUSA04FEB':'27_0P00001LPH_MSCI Finland Value USD',
'XIUSA04FEK':'27_0P00001LPQ_MSCI France Value USD',
'XIUSA04FEV':'27_0P00001LQ1_MSCI Germany Value USD',
'FOUSA06DKM':'27_0P00008JH1_MSCI Greece Value USD',
'XIUSA04FFN':'27_0P00001LQT_MSCI Italy Value USD',
'XIUSA04FGH':'27_0P00001LRN_MSCI Netherlands Value USD',
'XIUSA04FH8':'27_0P00001LSE_MSCI Norway Value USD',
'XIUSA04FIK':'27_0P00001LTQ_MSCI Portugal Value USD',
'XIUSA04FJ3':'27_0P00001LU9_MSCI Spain Value USD',
'XIUSA04FJE':'27_0P00001LUK_MSCI Sweden Value USD',
'XIUSA04FJN':'27_0P00001LUT_MSCI Switzerland Value USD',
'XIUSA04FKH':'27_0P00001LVN_MSCI UK Value USD',
'XIUSA04FBB':'27_0P00001LMH_MSCI Europe Value USD',
'XIUSA04F6K':'27_0P00001LHQ_MSCI EMU Value USD',
'XIUSA04FB2':'27_0P00001LM8_MSCI Europe Ex UK Value USD',
'XIUSA04FGQ':'27_0P00001LRW_MSCI Nordic Countries Value USD',
'XIUSA04F0I':'27_0P00001LBO_MSCI Australia Value USD',
'XIUSA04FF6':'27_0P00001LQC_MSCI Hong Kong Value USD',
'XIUSA04FFW':'27_0P00001LR2_MSCI Japan Value USD',
'FOUSA06DND':'27_0P00008JJS_MSCI New Zealand Value USD',
'FOUSA06DPB':'27_0P00008JLQ_MSCI Singapore Value USD',
'XIUSA04FI1':'27_0P00001LT7_MSCI Pacific Value USD',
'XIUSA04FHH':'27_0P00001LSN_MSCI Pacific Ex Japan Value USD',
'XIUSA04F1B':'27_0P00001LCH_MSCI Canada Value USD',
'XIUSA04FKQ':'27_0P00001LVW_MSCI USA Value USD',
'XIUSA04FGZ':'27_0P00001LS5_MSCI North America Value USD',
'XIUSA04F2E':'27_0P00001LDK_MSCI EAFE Value USD',
'FOUSA05USV':'27_0P00006QAF_MSCI Far East Value USD',
'FOUSA06DM2':'27_0P00008JIH_MSCI Israel Value USD',
'XIUSA04FK6':'27_0P00001LVC_MSCI World Value USD',
'XIUSA04F2N':'27_0P00001LDT_MSCI EASEA Value USD',
'FOUSA06DOV':'27_0P00008JLA_MSCI Singapore Free Value USD',
'XIUSA04F1L':'27_0P00001LCR_MSCI China Value USD',
'FOUSA06DL6':'27_0P00008JHL_MSCI India Value USD',
'FOUSA06DLC':'27_0P00008JHR_MSCI Indonesia Value USD',
'XIUSA04FG4':'27_0P00001LRA_MSCI Korea Value USD',
'FOUSA05RMW':'27_0P00006LYA_MSCI Malaysia Value NR USD',
'FOUSA06DO7':'27_0P00008JKM_MSCI Philippines Value USD',
'FOUSA06DQB':'27_0P00008JMQ_MSCI Taiwan Value USD',
'FOUSA06DQH':'27_0P00008JMW_MSCI Thailand Value USD',
'XIUSA04F33':'27_0P00001LE9_MSCI EM Asia Value USD',
'FOUSA05URF':'27_0P00006QAF_MSCI EM Far East Value USD',
'FOUSA06DFE':'27_0P00008JBT_MSCI Brazil Value USD',
'FOUSA06DFK':'27_0P00008JBZ_MSCI Chile Value USD',
'FOUSA06DFO':'27_0P00008JC3_MSCI Colombia Value USD',
'FOUSA06DMY':'27_0P00008JJD_MSCI Mexico Value USD',
'FOUSA06DO1':'27_0P00008JKG_MSCI Peru Value USD',
'XIUSA04F3P':'27_0P00001LEV_MSCI EM Latin America Value USD',
'FOUSA06DFU':'27_0P00008JC9_MSCI Czech Republic Value USD',
'FOUSA06DKY':'27_0P00008JHD_MSCI Hungary Value USD',
'FOUSA06DOD':'27_0P00008JKS_MSCI Poland Value USD',
'XIUSA04FIS':'27_0P00001LTY_MSCI Russia Value USD',
'FOUSA06DQN':'27_0P00008JN2_MSCI Turkey Value USD',
'XIUSA04F3D':'27_0P00001LEJ_MSCI EM Europe Value USD',
'FOUSA05UR7':'27_0P00006Q9P_MSCI EM Eastern Europe Value USD',
'FOUSA06F87':'27_0P00008L48_MSCI Egypt Value USD',
'FOUSA06F8D':'27_0P00008L4E_MSCI Morocco Value USD',
'FOUSA06DPN':'27_0P00008JM2_MSCI South Africa Value USD',
'XIUSA04F2V':'27_0P00001LE1_MSCI EM Value USD',
'FOUSA063SM':'27_0P00007ZAQ_MSCI EAFE&Canada Growth USD',
'XIUSA04F29':'27_0P00001LDF_MSCI EAFE Growth USD',
'FOUSA063SU':'27_0P00007PNK_MSCI EAFE Ex UK Growth USD',
'XIUSA04F2H':'27_0P00001LDN_MSCI EASEA Growth USD',
'XIUSA04F6D':'27_0P00001LHJ_MSCI EMU Growth USD',
'FOUSA05UR9':'27_0P00006Q9V_MSCI EM Europe&ME Growth USD',
'XIUSA04FB5':'27_0P00001LMB_MSCI Europe Growth USD',
'XIUSA04FAW':'27_0P00001LM2_MSCI Europe Ex UK Growth USD',
'FOUSA05UST':'27_0P00006QD1_MSCI Far East Growth USD',
'XIUSA04FGK':'27_0P00001LRQ_MSCI Nordic Countries Growth USD',
'XIUSA04FGT':'27_0P00001LRZ_MSCI North America Growth USD',
'XIUSA04FHV':'27_0P00001LT1_MSCI Pacific Growth USD',
'XIUSA04FHB':'27_0P00001LSH_MSCI Pacific Ex Japan Growth USD',
'XIUSA04FK0':'27_0P00001LV6_MSCI World Growth USD',
'FOUSA05UZQ':'27_0P00006QJY_MSCI World Ex Australia Growth USD',
'FOUSA05V01':'27_0P00006QK9_MSCI World Ex UK Growth USD',
'FOUSA05V07':'27_0P00006QKF_MSCI World Ex USA Growth USD',
'XIUSA04F23':'27_0P00001LD9_MSCI EAFE Free Growth USD',
'FOUSA05USP':'27_0P00006QCX_MSCI Far East Free Growth USD',
'XIUSA04FHQ':'27_0P00001LSW_MSCI Pacific Free Growth USD',
'XIUSA04FJU':'27_0P00001LV0_MSCI World Free Growth USD',
'XIUSA04F0L':'27_0P00001LBR_MSCI Austria Growth USD',
'XIUSA04F0U':'27_0P00001LC0_MSCI Belgium Growth USD',
'XIUSA04F1S':'27_0P00001LCY_MSCI Denmark Growth USD',
'XIUSA04FE5':'27_0P00001LPB_MSCI Finland Growth USD',
'XIUSA04FEE':'27_0P00001LPK_MSCI France Growth USD',
'XIUSA04FEP':'27_0P00001LPV_MSCI Germany Growth USD',
'FOUSA06DKI':'27_0P00008JGX_MSCI Greece Growth USD',
'FOUSA06DLE':'27_0P00008JHT_MSCI Ireland Growth USD',
'XIUSA04FFH':'27_0P00001LQN_MSCI Italy Growth USD',
'XIUSA04FGB':'27_0P00001LRH_MSCI Netherlands Growth USD',
'XIUSA04FH2':'27_0P00001LS8_MSCI Norway Growth USD',
'XIUSA04FID':'27_0P00001LTJ_MSCI Portugal Growth USD',
'XIUSA04FIX':'27_0P00001LU3_MSCI Spain Growth USD',
'XIUSA04FJ8':'27_0P00001LUE_MSCI Sweden Growth USD',
'XIUSA04FJH':'27_0P00001LUN_MSCI Switzerland Growth USD',
'XIUSA04FKB':'27_0P00001LVH_MSCI UK Growth USD',
'XIUSA04FB5':'27_0P00001LMB_MSCI Europe Growth USD',
'XIUSA04F6D':'27_0P00001LHJ_MSCI EMU Growth USD',
'XIUSA04FAW':'27_0P00001LM2_MSCI Europe Ex UK Growth USD',
'XIUSA04FGK':'27_0P00001LRQ_MSCI Nordic Countries Growth USD',
'XIUSA04F0C':'27_0P00001LBI_MSCI Australia Growth USD',
'XIUSA04FF0':'27_0P00001LQ6_MSCI Hong Kong Growth USD',
'XIUSA04FFQ':'27_0P00001LQW_MSCI Japan Growth USD',
'FOUSA06DN6':'27_0P00008JJL_MSCI New Zealand Growth USD',
'FOUSA06DP3':'27_0P00008JLI_MSCI Singapore Growth USD',
'XIUSA04FHV':'27_0P00001LT1_MSCI Pacific Growth USD',
'XIUSA04FHB':'27_0P00001LSH_MSCI Pacific Ex Japan Growth USD',
'XIUSA04F15':'27_0P00001LCB_MSCI Canada Growth USD',
'XIUSA04FKK':'27_0P00001LVQ_MSCI USA Growth USD',
'XIUSA04FGT':'27_0P00001LRZ_MSCI North America Growth USD',
'XIUSA00142':'27_0P00001GN4_MSCI EAFE Small Cap USD',
'FOUSA05UST':'27_0P00006QD1_MSCI Far East Growth USD',
'FOUSA06DLU':'27_0P00008JI9_MSCI Israel Growth USD',
'XIUSA04FK0':'27_0P00001LV6_MSCI World Growth USD',
'XIUSA04F2H':'27_0P00001LDN_MSCI EASEA Growth USD',
'FOUSA06DON':'27_0P00008JL2_MSCI Singapore Free Growth USD',
'XIUSA04F1H':'27_0P00001LCN_MSCI China Growth USD',
'FOUSA06DL2':'27_0P00008JHH_MSCI India Growth USD',
'FOUSA06DLA':'27_0P00008JHP_MSCI Indonesia Growth USD',
'XIUSA04FG0':'27_0P00001LR6_MSCI Korea Growth USD',
'FOUSA05RMQ':'27_0P00006LY4_MSCI Malaysia Growth NR USD',
'FOUSA06DO5':'27_0P00008JKK_MSCI Philippines Growth USD',
'FOUSA06DQ9':'27_0P00008JMO_MSCI Taiwan Growth USD',
'FOUSA06DQF':'27_0P00008JMU_MSCI Thailand Growth USD',
'XIUSA04F2Z':'27_0P00001LE5_MSCI EM Asia Growth USD',
'FOUSA05URD':'27_0P00006QA8_MSCI EM Far East Growth USD',
'FOUSA06DFC':'27_0P00008JBR_MSCI Brazil Growth USD',
'FOUSA06DFI':'27_0P00008JBX_MSCI Chile Growth USD',
'FOUSA06DFM':'27_0P00008JC1_MSCI Colombia Growth USD',
'FOUSA06DMU':'27_0P00008JJ9_MSCI Mexico Growth USD',
'FOUSA06DNX':'27_0P00008JKC_MSCI Peru Growth USD',
'XIUSA04F3L':'27_0P00001LER_MSCI EM Latin America Growth USD',
'FOUSA06DFQ':'27_0P00008JC5_MSCI Czech Republic Growth USD',
'FOUSA06DKU':'27_0P00008JH9_MSCI Hungary Growth USD',
'FOUSA06DO9':'27_0P00008JKO_MSCI Poland Growth USD',
'XIUSA04FIO':'27_0P00001LTU_MSCI Russia Growth USD',
'FOUSA06DQJ':'27_0P00008JMY_MSCI Turkey Growth USD',
'XIUSA04F39':'27_0P00001LEF_MSCI EM Europe Growth USD',
'FOUSA05UR5':'27_0P00006Q9J_MSCI EM Eastern Europe Growth USD',
'FOUSA06F8J':'27_0P00008L4K_MSCI Egypt Growth USD',
'FOUSA06F8P':'27_0P00008L4Q_MSCI Morocco Growth USD',
'FOUSA06DPJ':'27_0P00008JLY_MSCI South Africa Growth USD',
'XIUSA04F2R':'27_0P00001LDX_MSCI EM Growth USD',
'FOUSA08QT8':'27_0P0000JPY1_MSCI EAFE Mid PR USD',
'F00000HE7C':'27_0P0000NZL0_MSCI EMU Mid NR USD',
'F00000IT6K':'27_0P0000OPTT_MSCI Europe Mid Cap GR USD',
'F00000HFIU':'27_0P0000O0WK_MSCI North America Mid NR USD',
'FOUSA08N4T':'27_0P0000IQ03_MSCI World Mid USD',
'FOUSA063SO':'27_0P00007PNE_MSCI EAFE&Canada Small Cap USD',
'FOUSA063SS':'27_0P00007PNI_MSCI EAFE Ex UK Small Cap USD',
'XIUSA04F2K':'27_0P00001LDQ_MSCI EASEA Small Cap USD',
'XIUSA04F6H':'27_0P00001LHN_MSCI EMU Small Cap USD',
'XIUSA04FB8':'27_0P00001LME_MSCI Europe Small Cap USD',
'XIUSA04FAZ':'27_0P00001LM5_MSCI Europe Ex UK Small Cap USD',
'XIUSA04FE2':'27_0P00001LP8_MSCI Far East Small Cap USD',
'XIUSA04FGN':'27_0P00001LRT_MSCI Nordic Countries Small Cap USD',
'XIUSA04FGW':'27_0P00001LS2_MSCI North America Small Cap USD',
'XIUSA04FHY':'27_0P00001LT4_MSCI Pacific Small Cap USD',
'XIUSA04FHE':'27_0P00001LSK_MSCI Pacific Ex Japan Small Cap USD',
'XIUSA04FK3':'27_0P00001LV9_MSCI World Small Cap USD',
'FOUSA05V03':'27_0P00006QKB_MSCI World Ex UK Small Cap USD',
'XIUSA04GSF':'27_0P00001QLZ_MSCI World Ex USA Small Cap USD',
'XIUSA04F0X':'27_0P00001LC3_MSCI Belgium Small Cap USD',
'XIUSA04FES':'27_0P00001LPY_MSCI Germany Small Cap USD',
'FOUSA05S4J':'27_0P00006MFX_MSCI Greece Small Cap USD',
'FOUSA06E8D':'27_0P00008K4R_MSCI Ireland Small Cap USD',
'XIUSA04FFK':'27_0P00001LQQ_MSCI Italy Small Cap USD',
'XIUSA04FH5':'27_0P00001LSB_MSCI Norway Small Cap USD',
'XIUSA04FIH':'27_0P00001LTN_MSCI Portugal Small Cap USD',
'XIUSA04FJ0':'27_0P00001LU6_MSCI Spain Small Cap USD',
'XIUSA04FJ8':'27_0P00001LUE_MSCI Sweden Growth USD',
'XIUSA04FJK':'27_0P00001LUQ_MSCI Switzerland Small Cap USD',
'XIUSA04FKE':'27_0P00001LVK_MSCI UK Small Cap USD',
'XIUSA04FB8':'27_0P00001LME_MSCI Europe Small Cap USD',
'XIUSA04F6H':'27_0P00001LHN_MSCI EMU Small Cap USD',
'XIUSA04FAZ':'27_0P00001LM5_MSCI Europe Ex UK Small Cap USD',
'XIUSA04FGN':'27_0P00001LRT_MSCI Nordic Countries Small Cap USD',
'XIUSA04F0F':'27_0P00001LBL_MSCI Australia Small Cap USD',
'XIUSA04FF3':'27_0P00001LQ9_MSCI Hong Kong Small Cap USD',
'XIUSA04FFT':'27_0P00001LQZ_MSCI Japan Small Cap USD',
'FOUSA05S59':'27_0P00006MGN_MSCI New Zealand Small Cap USD',
'FOUSA05S5X':'27_0P00006MHB_MSCI Singapore Small Cap USD',
'XIUSA04FHY':'27_0P00001LT4_MSCI Pacific Small Cap USD',
'XIUSA04FHE':'27_0P00001LSK_MSCI Pacific Ex Japan Small Cap USD',
'XIUSA04F18':'27_0P00001LCE_MSCI Canada Small Cap USD',
'XIUSA04FKN':'27_0P00001LVT_MSCI USA Small Cap USD',
'XIUSA04FGW':'27_0P00001LS2_MSCI North America Small Cap USD',
'XIUSA00142':'27_0P00001GN4_MSCI EAFE Small Cap USD',
'XIUSA04FE2':'27_0P00001LP8_MSCI Far East Small Cap USD',
'XIUSA04FK3':'27_0P00001LV9_MSCI World Small Cap USD',
'XIUSA04F2K':'27_0P00001LDQ_MSCI EASEA Small Cap USD'

}
var tickerValidation = function(cType){  // cType: widget type.
    this.componentType = cType;
    this.isOrderedLevelIIData = cType == 6?true:false;  
	this.defaultBSubscribe = cType == 0 || cType == 1 ||cType == 5 ||cType == 6 || cType == 8 || cType==10 || cType ==11|| cType ==14 || cType ==17 ||cType == 16?true:false;
 	this.needSubscribePushData = this.defaultBSubscribe;
    this.cacheData = [];
    this.ErrorArray={
        "0P00001ISJ":["ASX","151"]//FTSE AllSh PR
    };
    this.mapIndex = {};
	this.needFilterSecurityType=true;
	this.subUSExchange = [41,11,9,30,29,33,22,25]; 
    //this.dataManager = typeof QS=='undefined'||QS.Data=='undefined'?null:QS.Data;
    this.showAlert = true;
    //this.getDataCallback = _getDataCallback;      
};
tickerValidation.prototype = {
    checkTickers: function(symbols, _getDataCallback, bSubscribe){
        this.getDataCallback = _getDataCallback;
        if (!symbols || !symbols.length || symbols.length < 1) {
            this.getDataCallback([],[]);
        }else{
            var t = typeof(symbols) == "object" ? symbols : symbols.split(",");
            var needToCheckTickers = [], setData = [], forexData = [];
            this.cacheData = [];
            this.mapIndex = {};
            this.searchStr = "";
            this.inuputS = t;
            if (typeof(bSubscribe) != "undefined") {
                this.needSubscribePushData = bSubscribe;
            } else {
                this.needSubscribePushData = this.defaultBSubscribe; // default value.
            }
            for (var i = 0; i < t.length; i++) {
                if (!t[i] && t[i] == "") 
                    continue;
                t[i] = t[i].toUpperCase();
                this.mapIndex[t[i].toUpperCase()] = i; // map the index.
                if(gIdMap[t[i]]){
                    if(gData[gIdMap[t[i]]]&& gData[gIdMap[t[i]]]["checked"]){
                        setData.push(gIdMap[t[i]]);
                        this.cacheData[i]=gIdMap[t[i]];
                        continue               // ticker info has exist
                    } else {
                        needToCheckTickers.push(t[i]);
                    }
                    
                } else if(gData[t[i]]){
                    if(gData[t[i]]["checked"]){
                        setData.push(t[i]);
                        this.cacheData[i] = t[i];
                        continue;
                    } else {
                        needToCheckTickers.push(t[i]);
                    }
                } else if((t[i].indexOf('%') == 0||t[i].indexOf('CU$$') == 0 || t[i].indexOf('245:') == 0||t[i].indexOf('240:') == 0) && t[i].length > 5){ //is FOREX -- david
                    if (t[i].indexOf('%') == 0) {
                        t[i] = '245:' + t[i].replace('%', '').replace('/', '') + 'FLIT';
                    }else if (t[i].indexOf('CU$$') == 0) {
                        t[i] = '245:' + t[i].replace('CU$$', '').replace('/', '') + 'FLIT';
                    }
                    //forexData.push(t[i]);
                    this._storeForexData(t[i]); // store info to gData needn't to ID service.
                    this.cacheData[i] = t[i];
                    setData.push(t[i]);
                    continue;
                } else if(t[i].indexOf('/') == 0){ //is FUTURE -- yuntao
                    t[i] = t[i].replace('/', '');
                    //futureData.push(t[i]);
                    this._storeFutureData(t[i]); // store info to gData needn't to ID service.
                    this.cacheData[i] = t[i];
                    setData.push(t[i]);
                    continue;
                }else if(t[i]=='0P00006K76'||t[i]=='FOUSA05PVR'){//hard code for 233.1.IPSA, once IDService is ok,we need remove it.
    				this._storeSpecialIPSAData('233:IPSA');
    				this.cacheData[i] = '233:IPSA';
                    setData.push('233:IPSA');
    				continue;
    			}else if(t[i]=='0P00006NNM'){
                    this._storeSpecialIndexData('136:000001');
                    this.cacheData[i] = '136:000001';
                    setData.push('136:000001');
                }else if(/^\d+:\d+:\S+$/.test(t[i])){ // tenforeExchange:securityType_tenforeTicker: 126:1:IBM
    				var tls = t[i].split(":"),tExch=tls[0],secType=tls[1],tTicker=tls[2],gkey;
    				if(tExch<126&&(secType==1||secType==10||secType==8)){
    					gkey = 126+":"+tTicker;
    				} else{
    					gkey = tExch+":"+tTicker;
    				}
    				if(!gData[gkey]) gData[gkey] = {};
    				gData[gkey].checked =  true;
    				gData[gkey].hasStaticData =  true;
    				gData[gkey].performanceId = t[i];
					gData[gkey]["noPID"]=true;
    				gData[gkey].secId = t[i];
    				gData[gkey].Name = tTicker;
    				gData[gkey].type = secType;
    				gData[gkey].mType = (secType==7||secType==8||secType==11||secType==16)?"Bond":secType==13?"Spread":secType==2?"Options":secType==3?"FU":secType==10?"XI":"ST";
    				gData[gkey]["R/D"] = "D";
    				gData[gkey].ticker = tTicker;
    				gData[gkey].clientTicker = tTicker;
    				gData[gkey].tenforeTicker = tTicker;
    				gData[gkey].tenforeCode = tExch;
    				gIdMap[t[i]] = gkey; //performance Id
    				//gIdMap[secId] = gKey; // sec ID; 
    				this.cacheData[i] = gkey;
                    setData.push(gkey)
    				continue;
    				
    			}else if(t[i].indexOf('@@@') ==0){//suport mutil-language by user define the gData
                    var gkey = t[i].replace('@@@', '');
                    this.cacheData[i] = gkey;
                    setData.push(gkey);
                    continue;
                }else if(typeof(QS_MSICIndexs)!="undefined"&& QS_MSICIndexs[t[i]]){  //t[i] is secId
                    var ls = QS_MSICIndexs[t[i]].split("_");  // exchangeCode_pId_name
                    var key = ls[0]+":"+ls[1];
                    if(gData[key]&&gData[key].checked){  // exist in gData.
                        setData.push(key);
                        this.cacheData[i]=key;
                        continue
                    }else{
                        this._storeMSCIData(t[i],ls); // store info to gData needn't to ID service.
                        this.cacheData[i] = key;
                        setData.push(key);
                    }
                } else {
                    needToCheckTickers.push(t[i]);
                }
            }
            if (setData.length > 0) {
                if (this.needSubscribePushData) { // subscribe data.
                    var plist = [], subscribeList = [];
                    for (var j = 0; j < setData.length; j++) {
                        plist = this.checkDataPermissionByKey(setData[j]);
                        if (plist.length > 0) {
                            subscribeList.push({
                                gkey: setData[j],
                                paraList: plist,
                                isSubscribeLevelII: this.isOrderedLevelIIData
                            });
                        }
                    }
                    if(subscribeList.length > 0){
                        push.proxy.batchSubscribe(subscribeList);
                        
                    }
                }
            }
            if(needToCheckTickers.length > 0){    // need reqest Id and static data service to check the tickers and get static data.
                this.getTickerInfo(needToCheckTickers);
            }else{  // remove the null ticker.
                if(this.cacheData.length > 0){
                    for(var j=0;j < this.cacheData.length; j++){
                        if(!this.cacheData[j]){
                            this.cacheData.splice(j,1);
                            j--;
                        }
                    }
                }
                if (typeof(this.getDataCallback) == "function") { // check tickers info success excute the callback.
                    this._checkSecurityModulePermission();
                }
            }
        }
    },
	_checkSecurityModulePermission:function(failedTickers){
		var ft = failedTickers||[];
        if (this.componentType < 50 && typeof(QS_SMC) != "undefined") {
            if (this.cacheData.length&&QS_SMC.checkSecurityType(gData[this.cacheData[0]].mType, this.componentType)) {
                this.getDataCallback(this.cacheData, ft);
            } else {
                this.showAlert&&Util.message(QS_Lang.text?QS_Lang.text["notavail"]:"Data not available.");
                this.getDataCallback([], ft);
            }
        } else {
            this.getDataCallback(this.cacheData, ft);
        }
    },
	_storeSpecialIPSAData:function(gKey){
		var ls=gKey.split(":");
		if (!gData[gKey]){
            gData[gKey] = {};
        }
        gData[gKey].checked = true;
		gData[gKey].currency='CLP';
		gData[gKey].Domicile='CHL';
		gData[gKey].Region='CHL';
        gData[gKey].tenforeTicker = ls[1];
        gData[gKey].tenforeCode = ls[0];
        gData[gKey].ticker = ls[1];
        gData[gKey].clientTicker = gData[gKey].ticker;
        gData[gKey].secId = 'FOUSA05PVR';
        gData[gKey].performanceId = '0P00006K76';
        gData[gKey].type ="10";
		gData[gKey]["Name"] = 'Bolsa De Santiago IPSA Chile';
		gData[gKey].mType ="XI";
        gData[gKey]["R/D"] = 'D';
        gIdMap[gData[gKey].performanceId] = gKey; //performance Id
		gIdMap[gData[gKey].secId] = gKey; //performance Id
        gIdMap[gKey] = gKey; // sec ID;// add to gIdMap
	},
    _storeSpecialIndexData:function(gKey){//for solve SHANGHAI index no tenfore info
        var ls=gKey.split(":");
        if (!gData[gKey]){
            gData[gKey] = {};
        }
        gData[gKey].checked = true;
        gData[gKey].currency='CNY';
        gData[gKey].Region='CHN';
        gData[gKey].tenforeTicker = ls[1];
        gData[gKey].tenforeCode = ls[0];
        gData[gKey].ticker = ls[1];
        gData[gKey].clientTicker = gData[gKey].ticker;
        gData[gKey].secId = 'FOUSA05TC8';
        gData[gKey].performanceId = '0P00006NNM';
        gData[gKey].type ="10";
        gData[gKey]["Name"] = 'Shanghai SE Composite PR CNY';
        gData[gKey].mType ="XI";
        gData[gKey]["R/D"] = 'D';
        gIdMap[gData[gKey].performanceId] = gKey; //performance Id
        gIdMap[gData[gKey].secId] = gKey; //performance Id
        gIdMap[gKey] = gKey; // sec ID;// add to gIdMap
    },
    _storeForexData:function(gKey){  // store ID info to gData for Forex.
        var ls = gKey.split(":");
        if (!gData[gKey]){
            gData[gKey] = {};
        }
        gData[gKey].checked = true;
        gData[gKey].exch = 'FOREX';
        gData[gKey].tenforeTicker = ls[1];
        gData[gKey].tenforeCode = ls[0];
        gData[gKey].hasStaticData = true;
        gData[gKey].ticker = ls[1].substring(0, 3) + '/' + ls[1].substring(3, 6);
        gData[gKey].clientTicker = gData[gKey].ticker;
        gData[gKey].secId = gKey;
        gData[gKey].performanceId = "CU$$"+(ls[1].length>6?ls[1].substr(0,6):ls[1]);  // use the performanceId to get historical data from TSDB.
        gData[gKey].type ="20";
		gData[gKey]["Name"] = gData[gKey].ticker;
		gData[gKey].mType ="FX";
        gData[gKey]["R/D"] = 'D';
        gIdMap[gData[gKey].performanceId] = gKey; //performance Id
        gIdMap[gKey] = gKey; // sec ID;                      // add to gIdMap
    },
    _storeFutureData:function(gKey){  // store ID info to gData for furture.
        var ls = gKey.split(":");               
        var k=ls[1].substring(0,ls[1].length-2);
        if (!gData[gKey]) {
            gData[gKey] = {};                    
        }
        gData[gKey].checked =  true;
        gData[gKey].exch =typeof QS_FuturesMap!='undefined'&&QS_FuturesMap[k]?QS_FuturesMap[k][1]:'';
        gData[gKey].Name = typeof QS_FuturesMap!='undefined'&&QS_FuturesMap[k]?QS_FuturesMap[k][0]:'';
        gData[gKey].tenforeTicker = ls[1];
        gData[gKey].tenforeCode = ls[0];
        gData[gKey].hasStaticData =  true;
        gData[gKey].ticker = ls[1].substring(0, ls[1].length-2) +ls[1].substring(ls[1].length-1, ls[1].length)+ ls[1].substring(ls[1].length-2, ls[1].length-1);
        gData[gKey].clientTicker = gData[gKey].ticker;
        gData[gKey].secId = "/"+gKey;
        gData[gKey].performanceId =  "/"+gKey;
        gData[gKey].type = "3";
		gData[gKey].mType ='FU'; //furtures 
        gData[gKey]["R/D"] ='D'; 
        gIdMap["/"+gKey] = gKey; //performance Id
        gIdMap["/"+gKey] = gKey; // sec ID;   
    },
    _storeMSCIData:function(secId,ls){
        var gKey = ls[0]+":"+ls[1];
        if (!gData[gKey]) {
            gData[gKey] = {};                    
        }
        gData[gKey].checked =  true;
        gData[gKey].performanceId = ls[1];
        gData[gKey].secId = secId;
        gData[gKey].Name = ls[2];
        gData[gKey].type = 10;
        gData[gKey].mType = "XI";
        gData[gKey]["R/D"] = "D";
        gData[gKey].ticker = secId;
        gData[gKey].clientTicker = gData[gKey].ticker;
        gData[gKey].tenforeTicker = secId;
        gData[gKey].tenforeCode = ls[0];
        gIdMap[ls[1]] = gKey; //performance Id
        gIdMap[secId] = gKey; // sec ID;  
    },
    getSubcribeParas:function(aParams,sType,dataType,exchCode,subcodes,tTicker,isLevelII){
         var rItem = sType + push.subSeparator + tTicker+push.subSeparator,item;
         for (var i = 0; i < subcodes.length; i++) {
            if(typeof(subcodes[i])=="undefined"||subcodes[i]=="") continue;  //
            if(isLevelII&&subcodes[i] == "-1")continue;
            item = rItem + subcodes[i];
            if(isLevelII)item = item+push.subSeparator+"NN"; // no netting for level II data.
            aParams.push({
                sourceType: dataType,
                serviceName: exchCode,
                itemName: item,
                isLevelII:isLevelII
            });
        }
    },
    getForexSubscribeParas:function(gkey){
        if (gData[gkey]) {
            return {
                sourceType: "D",
                serviceName: 245,
                itemName: "20"+ push.subSeparator + gkey.split(":")[1] + push.subSeparator+"-1"
            }
        }else{
            return null;
        }
    },
	getFutureSubscribeParas:function(gkey){
        if (gData[gkey]) {
            return {
                sourceType: "D",
                serviceName: gkey.split(":")[0],
                itemName: "3"+ push.subSeparator + gkey.split(":")[1] + push.subSeparator+ "-1"
            }
        }else{
            return null;
        }
    },
    getIIVSubscribeParas: function(aParams, gkey){
        if(gData[gkey]){
            var pid = gData[gkey]["performanceId"] + "IIV";
            if (gIdMap[pid]) {
                var etf = gData[gIdMap[pid]], dy = "D", etfSubcodes = QS_Permission.getSubcodes(10, etf["tenforeCode"], etf["tenforeTicker"], "R", false);
                if (etfSubcodes.length) {
                    this.getSubcribeParas(aParams, 10, "R", etf["tenforeCode"], etfSubcodes, etf["tenforeTicker"]);
                } else {
                    etfSubcodes = QS_Permission.getSubcodes(10, etf["tenforeCode"], etf["tenforeTicker"], "D", false);
                    if (etfSubcodes.length) {
                        this.getSubcribeParas(aParams, 10, "D", etf["tenforeCode"], etfSubcodes, etf["tenforeTicker"]);
                    }
                }
            }
        }
    },
    _getDataType:function(){
        var  dataType = QS_DataType;
        if(typeof(dataType)=="undefined"||dataType=="bats"){
            dataType = "mix";
        }
        if(typeof(PULL_DATA_RATE[QS_DataType])!="undefined")dataType = "mix";  // pull .
        return dataType;
    },
    checkDataPermissionByKey: function(gkey,data){  // data is source if not store the data to gData use data to check permission.
        var d = typeof(data)== "undefined"?gData[gkey]:data;
        if(!d) return [];
        return this.checkDataPermission(d["tenforeCode"],d["tenforeTicker"],d["type"],d["country"],d["mType"]);
    },
    // check the permission for geting quote data from push server.
    checkDataPermission: function(eCode, tTicker, ty, country, mType){  // type: tenfore security type.
        var aParams = [];
        var exchCode, item, subcodes;
        var type = parseInt(ty, 10);
        subcodes = QS_Permission.getSubcodes(type,eCode,tTicker,"R");
        if (subcodes.length) { // user has subscribe real-time data permission.
            //var subcodes = [];
            if (((type==1||type==10||type==8||type==2)&& eCode<=126&&eCode != 50)) { // USA stock,MF,Options and index(use 126 as exchange to subscribe level I data.)
                if(eCode != 41&&eCode!=11&&eCode!=9&&eCode!=30&&eCode!=29&&eCode!=33) exchCode = "126"; // 11,41 exchange is removed from 126 exchange.
                else exchCode = eCode;
                if(type!=10){                   
                    subcodes = QS_Permission.getSubcodes(type,exchCode,tTicker,"R",false);  // get USCOMP exchange
                }
            }else {
                exchCode = eCode;
            }        
            if (this.isOrderedLevelIIData&& ty == 1) { // level II for Stock,etf,Open-end Fund
                if (eCode <= 126&&eCode != 50) { // US exchange.
                    this.getSubcribeParas(aParams,type,"R",exchCode,subcodes,tTicker); // get levelI subscribe parameters.
                    this.getSubcribeParas(aParams, type, "R", 14, QS_Permission.getSubcodes(type, 14, tTicker, "R"), tTicker, true);
                    this.getSubcribeParas(aParams, type, "R", 19, QS_Permission.getSubcodes(type, 19, tTicker, "R"), tTicker, true);
                    this.getSubcribeParas(aParams, type, "R", 1, QS_Permission.getSubcodes(type, 1, tTicker, "R"), tTicker, true);
                    this.getSubcribeParas(aParams, type, "R", 34, QS_Permission.getSubcodes(type, 34, tTicker, "R"), tTicker, true);
                }else { // other exchange. get levelI and levelII data.
                    this.getSubcribeParas(aParams, type, "R", eCode, QS_Permission.getSubcodes(type, eCode, tTicker, "R"), tTicker, true);
                }
            }else{
                 this.getSubcribeParas(aParams,type,"R",exchCode,subcodes,tTicker); // get levelI subscribe parameters.
            }
        } else {  // check the delayed and bats data permission.
            var  dataType = this._getDataType();  // mix, bats or delay.
            if (eCode > 126||(dataType=="delay"||dataType=="mix")) {   // Non_USA ticker or dataType is delay or mix for USA Tickerr. 
                exchCode = "";
                if ((type==1||type==10||type==8||type==2)&& eCode<=126&& $.inArray(parseInt(eCode,10),this.subUSExchange)<0) { // USA stock,MF, Options and index(use 126 as exchange to subscribe level I data.)
                    exchCode = "126"; 
                }else {
                    exchCode = eCode;
                }
                subcodes = QS_Permission.getSubcodes(type,exchCode,tTicker,"D",false);  // get USCOMP exchange
                this.getSubcribeParas(aParams,type,"D",exchCode,subcodes,tTicker); // get levelI subscribe parameters.
            }
            if (eCode <= 126&&eCode != 50 && (dataType == "bats" || dataType == "mix") && (ty==1)) { //user has order bats data for stock and etf in US market;
                this.getSubcribeParas(aParams,type,"R",17,QS_Permission.getSubcodes(type,17,tTicker,"R",false),tTicker)
            }
        }
        if (mType == "FE") { // get IIV subscribe parameters.
            var gkey = exchCode+":"+tTicker;
            this.getIIVSubscribeParas(aParams,gkey);
        }
        return aParams;
    },
    getTickerInfo: function(symbols){ // get ticker information from id service.
        this.searchStr = symbols.join(",");
        var self = this;
        checkTickerInfo(this.searchStr, function(o){
            self.onTickerInfoArrived(o)
        });
    },
	_fillSType:function(rs){
		var tInfo=rs.TenforeInfo||[];
		if((typeof rs.Type=='undefined'||rs.Type=='')&&tInfo.length>=3){
			if(tInfo[2]=='1'){
				rs.Type='ST';
			}else if(tInfo[2]=='10'){
				rs.Type='XI';
			}
		}
	},
    onTickerInfoArrived: function(data){
        var noFindTickers = [],noTenforeInfoTicker=[], noPermissionTickers = [],subscribeParaList = [],noSecuritityTypePermission=[];
		var instSecuTypePermissionList =null;
		if(GOLBAL_DATA&&GOLBAL_DATA.InstitutionSecuritityTypePermission){
			instSecuTypePermissionList=GOLBAL_DATA.InstitutionSecuritityTypePermission[InstitutionId];
		}
        if ((!data || !data.Records || data.Records.length < 1) && this.showAlert) {
            var ms = String.format(QS_Lang.text?QS_Lang.text["tickervalidationnotfound"]:"We could not find the security \"{0}\" you are looking for. Please try again.", this.searchStr);
            Util.message(ms);
            this.searchStr = "";
        } else {
            this.searchStr = "";
            //var needGetStaticInfoTickers = [];
            var rs, lg = data.Records.length;
            var tenforInfo,gkey,subscribePara=null,keyList = [];
            var shortExchName;
            for (var i = 0; i < lg; i++) {
                rs = data.Records[i],subscribePara=[];
                tenforInfo = rs.TenforeInfo;
				this._fillSType(rs);//auto-fill the Type when it is empty and tenfore type exist.
				if(this.needFilterSecurityType&&instSecuTypePermissionList&&(!instSecuTypePermissionList[rs.Type]||!instSecuTypePermissionList[rs.Type])){
					//console.log(rs.Type+" no");
					if(SYMBLETYPE[rs.Type]){
						noSecuritityTypePermission.push(SYMBLETYPE[rs.Type]);
					}else if(rs.Type&&rs.Type !=""){
						noSecuritityTypePermission.push(rs.Type);
					}
					continue;
				}
                if (tenforInfo && tenforInfo.length > 1) {
					gkey = tenforInfo[1] + ":" + tenforInfo[0];
					if ((rs.Type == "XI"||rs.Type == "ST"||rs.Type=="FE"||rs.Type=="FC"||rs.Type=="FO"||rs.Type=="--"||rs.Type=="")&& rs.TenforeInfo[1] <= 126) {// USA sercurity  //rs.Type != "XI" && rs.Region.toUpperCase() == "USA") || (
						gkey = "126:" + tenforInfo[0];
					}
					//keyList.push(gkey);
                    subscribePara=this.checkDataPermissionByKey(gkey, {
                        tenforeCode: tenforInfo[1],
                        tenforeTicker: tenforInfo[0],
                        type: toStockTypeCode(rs.Type,tenforInfo[1],tenforInfo[2]),
                        country: rs["Region"],
                        mType: rs["Type"]
                    });
				}else{  // no tenfore exchange and tenfore ticker.
					/*if(rs.Ticker==""&&rs.PID&&GB_autoCompleteBoxDataManager&&GB_autoCompleteBoxDataManager.idMap&&GB_autoCompleteBoxDataManager.idMap[rs.PID]&&GB_autoCompleteBoxDataManager.idMap[rs.PID]["OS001"]){
						rs.Ticker = GB_autoCompleteBoxDataManager.idMap[rs.PID]["OS001"];
					}*/  //please do not remove
                    noTenforeInfoTicker.push(rs["QueryKey"]);
                    var ticker=$.trim(rs.Ticker);
					tenforInfo=[(ticker.length>0?ticker:rs.PID),mockExchangeCode+(typeof(rs.Type)!="undefined"?"_"+rs.Type:"")];
					gkey = tenforInfo[1] + ":" + tenforInfo[0];
					if((rs.PID==""||rs.PID==null)&&(rs.SID==""||rs.SID==null)){  // no tenfore information and permformance id ans sec id.
						if (rs.Ticker != "") {
	                        noFindTickers.push(rs["Ticker"]);
	                    }else if (rs.Name != "") {
	                        noFindTickers.push(rs.Name);
	                    }else {
	                        noFindTickers.push(rs["QueryKey"]);
	                    }
                        continue;//if no pid , the ticker is invalid.
					}
				}
                if (subscribePara.length < 1&&tenforInfo[1].indexOf(mockExchangeCode+"_")<0) { // no permission to access this ticker.
					shortExchName = gMICExangeMap[rs["Exch"]] ? gMICExangeMap[rs["Exch"]] : rs["Exch"];//replace MICCODE to short exchange name
					var _tempMsg = shortExchName + ":" + rs["Ticker"];
					if(_tempMsg=":"&&rs.TenforeInfo&&rs.TenforeInfo.length>0&&rs.TenforeInfo[0]!=""){
						_tempMsg = rs.TenforeInfo[0];
					}
                	noPermissionTickers.push(_tempMsg); // there is no data permission to access this ticker.
				
                }else { // a legal ticker(1. has tenfore information and performance id or sec id. 2. only has performance id or sec id)
                    if (!gData[gkey] || !gData[gkey]["checked"]) { // not check ticker info and get static data.
                        if (!gData[gkey]) 
                            gData[gkey] = {};
                        gData[gkey]["tenforeCode"] = tenforInfo[1];
                        gData[gkey]["tenforeTicker"] = tenforInfo[0];
                        /*if (rs.PID && rs.PID != "") {
                            gIdMap[rs.PID] = gkey; //performance Id
                            gIdMap[rs.SID] = gkey; // sec ID;                      // add to gIdMap
                        }*/
                        if((rs.PID==""||rs.PID==null)&&(rs.SID==""||rs.SID==null)){ // no pid and sec id
                            gData[gkey]["noPID"]= true;
                        }
                        gData[gkey]["checked"] = true;
                        gData[gkey]["type"] = toStockTypeCode(rs.Type,tenforInfo[1],tenforInfo[2]); // sercurity type
                        gData[gkey]["mType"] = (rs.Type=="--"||rs.Type=="")?(gData[gkey]["type"]=="10"?"XI":gData[gkey]["type"]=="2"?"Options":"ST"):rs.Type;
                        gData[gkey]["performanceId"] = rs.PID==""?gkey:rs.PID;
                        gData[gkey]["secId"] = rs.SID==""?gkey:rs.SID;
                        gData[gkey]["exch"] = rs.Exch;
                        gData[gkey]["ticker"] = rs.Ticker||tenforInfo[0];
                        gData[gkey]["clientTicker"] = rs.ClientTicker||rs.Ticker;  //client ticker.
                        gData[gkey]["country"] = rs.Region;
                        gData[gkey]["currency"] = rs.Currency;
                        gData[gkey]["companyId"] = rs.CFID;
                        gData[gkey]["ISIN"] = rs.ISIN;
                        gData[gkey]["Name"] = rs.Name;
                        gData[gkey]["R/D"] = 'D'; //default data type - david
                        gData[gkey]["InitialDate"] = rs.InitialDate ? rs.InitialDate : "";
                        gData[gkey]["CUSIP"] = rs.CUSIP ? rs.CUSIP : "";
                        gIdMap[gData[gkey]["performanceId"]] = gkey; //performance Id
                        gIdMap[gData[gkey]["secId"]] = gkey; // sec ID;
                        if (rs.FundData) {
                            gData[gkey]["IMA_RDate"] = rs.FundData.IMA_RDate ? rs.FundData.IMA_RDate : "";
                            gData[gkey]["MStar_RDate"] = rs.FundData.MStar_RDate ? rs.FundData.MStar_RDate : "";
                        }
                        if (rs.Type == "FE" && rs.EtfData != null && rs.EtfData.IIV && rs.EtfData.IIV.TenforeInfo != null) { //IIV for ETF ticker.
                            var ex = gkey.split(":")[0];
                            var etf = rs.EtfData.IIV;
                            var eKey = ex + ":" + etf.TenforeInfo[0];
                            if (!gData[eKey]) {
                                gData[eKey] = {};
                                gData[eKey]["checked"] = true;
                                gData[eKey]["tenforeCode"] = ex;//etf.TenforeInfo[1];
                                gData[eKey]["tenforeTicker"] = etf.TenforeInfo[0];
                                gData[eKey]["mType"] = "FE"; //etf.Type;
                                gData[eKey]["type"] = toStockTypeCode(etf.Type,ex,etf.TenforeInfo[2]); // sercurity type
                                gData[eKey]["performanceId"] = rs.PID + "IIV";
                                gData[eKey]["secId"] = rs.SID;
                                gData[eKey]["exch"] = etf.Exch;
                                gData[eKey]["ticker"] = etf.Ticker;//
                                gData[eKey]["clientTicker"] = etf.Ticker;// client ticker.
                                gData[eKey]["country"] = etf.Region;
                                //gData[eKey]["currency"] = etf.Currency;
                                //gData[eKey]["companyId"] = etf.CFID;
                                //gData[eKey]["ISIN"] = etf.ISIN;
                                gData[eKey]["Name"] = etf.Name;
                                gIdMap[gData[eKey]["performanceId"]] = eKey;
                                //gIdMap[gData[eKey]["secId"]] = eKey;
                                gData[eKey]["gkey"] = eKey;
                            }
                            this.getIIVSubscribeParas(subscribePara, gkey); // subscribe ETF.
                        }
                        //needGetStaticInfoTickers.push(rs.SID);
                    }
                    if (this.mapIndex[rs["QueryKey"]] > -1) {
                        this.cacheData[this.mapIndex[rs["QueryKey"]]] = gkey;
                    }else if(this.mapIndex[rs["Exch"] + ":" + rs["QueryKey"]] > -1) {
        				this.cacheData[this.mapIndex[rs["Exch"] + ":" + rs["QueryKey"]]] = gkey;
                        if(gData[gkey]["performanceId"]==gkey) {
                            gData[gkey]["performanceId"]=rs["Exch"]+":"+rs["QueryKey"];
                            gIdMap[gData[gkey]["performanceId"]] = gkey; //performance Id
                        }
                        if(gData[gkey]["secId"]==gkey) {
                            gData[gkey]["secId"]=rs["Exch"]+":"+rs["QueryKey"];
                            gIdMap[gData[gkey]["secId"]] = gkey; // sec ID;
                        }
        			}else if(this.mapIndex[rs["Exch"] + ":" + rs["Ticker"]] > -1){  // if some ticker has no pid ,its QueryKey will be empty string. 
                        this.cacheData[this.mapIndex[rs["Exch"]+":"+rs["Ticker"]]] = gkey;
                        if(gData[gkey]["performanceId"]==gkey) {
                            gData[gkey]["performanceId"]=rs["Exch"]+":"+rs["Ticker"];
                            gIdMap[gData[gkey]["performanceId"]] = gkey; //performance Id
                        
                        }
                        if(gData[gkey]["secId"]==gkey) {
                            gData[gkey]["secId"]=rs["Exch"]+":"+rs["Ticker"];
                            gIdMap[gData[gkey]["secId"]] = gkey; // sec ID;
                        }
                    }
					if(tenforInfo[1].indexOf(mockExchangeCode+"_")<0){ // no tenfore information, doesn't subscribe the data. 9999 is the mocked exchange for ticker.
						subscribeParaList.push({
	                        gkey: gkey,
	                        paraList: subscribePara,
	                        isSubscribeLevelII: this.isOrderedLevelIIData
	                    });
					} 
                }  
            }
        }
        var failedTickers = [];
        for (var i = 0; i < this.inuputS.length; i++) { // find the failed tickers.
            if (!this.cacheData.length || this.cacheData.length <= i || !this.cacheData[i]) {
                failedTickers.push(this.inuputS[i]);
            }
        }
        if (this.cacheData.length > 0) { // remove the null item from the array.
            for (var j = 0; j < this.cacheData.length; j++) {//remove the null ticker.
                if (!this.cacheData[j]) {
                    this.cacheData.splice(j, 1);
                    j--;
                }
            }
            
        }
        if(this.needSubscribePushData && subscribeParaList.length > 0){
            push.proxy.batchSubscribe(subscribeParaList);
            //console.log(subscribeParaList);
        }
        var msg
        if (this.showAlert && noFindTickers.length > 0) {
            msg = String.format(QS_Lang.text?QS_Lang.text["tickervalidationnotfound"]:"We could not find the security \"{0}\" you are looking for. Please try again.", noFindTickers.join(', '));
            Util.message(msg);
        }
        if (this.showAlert&&noPermissionTickers.length > 0) {
            msg = String.format(QS_Lang.text?QS_Lang.text["tickervalidationnopermission"]:"You are not entitled to access \"{0}\"", noPermissionTickers.join(', '));
            Util.message(msg);
        }
		if (this.showAlert&&this.needFilterSecurityType&&noSecuritityTypePermission.length > 0) {
            msg = String.format(QS_Lang.text?QS_Lang.text["nosecurititytypepermission"]:"We are sorry, but you are not entitled to view the data for \"{0}\".", noSecuritityTypePermission.join(', '));
            Util.message(msg);
        }
        if (typeof(this.getDataCallback) == "function") { // check tickers info success excute the callback.
            //this.getDataCallback(this.cacheData, failedTickers);
			this._checkSecurityModulePermission(failedTickers);
        }
    },
    subscribe: function(gkeyList){ // subscribe the tickers which is verity by ID service. only subscribe Level I data. 
        if (!gkeyList || !gkeyList.length) 
            return;
        var k, paraList = [];
        for (var i = 0; i < gkeyList.length; i++) {
            k = gData[gkeyList[i]] ? gkeyList[i] : gIdMap[gkeyList[i]];
            if (!gData[k]) 
                continue;
            var subscribePara = this.checkDataPermissionByKey(k);
            if(subscribePara.length==0) continue;//some ticker don't be checked but there are no power eg.Future
            paraList.push({
                gkey: gkeyList[i],
                paraList: subscribePara,
                isSubscribeLevelII: false
            });
        }
        push.proxy.batchSubscribe(paraList);
        //console.log(paraList);
    },
    unSubscribe: function(gkeyList, notDeleteInfoFromGData){
        var k, list = [], subscribePara;
        for (var i = 0; i < gkeyList.length; i++) {
            k = gData[gkeyList[i]] ? gkeyList[i] : gIdMap[gkeyList[i]];
            if (!gData[k]) 
                continue;
            subscribePara = this.checkDataPermissionByKey(k);
            list.push({
                gkey: k,
                paraList: subscribePara,
                isSubscribeLevelII: this.isOrderedLevelIIData
            })
        }
        if(list.length > 0){
            push.proxy.batchUnsubscribe(list,notDeleteInfoFromGData);
        }
    }
};